package com.zx.web.dao.impl;

import com.zx.bean.GoodsType;
import com.zx.utils.DataSourceUtils;
import com.zx.web.dao.GoodsTypeDao;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 章鑫
 * @version V1.0
 * @Project 2022-09-05
 * @Package com.zx.web.dao.impl
 * @Description:
 * @Date 2022/9/14 11:25
 */
public class GoodsTypeDaoImpl implements GoodsTypeDao {
    QueryRunner qr = new QueryRunner(DataSourceUtils.getDataSource());
    @Override
    public List<GoodsType> findGoodsTypeL1() {
        String sql = "select * from  tb_goods_type where level = 1";
        try {
            return qr.query(sql, new BeanListHandler<>(GoodsType.class));
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }
}
